Skip to content

Fix UxDataset constructor and to_xarray() that got broken with xarray==2026.4.0#1492

Merged
erogluorhan merged 5 commits intomainfrom
fix_copy_constructor
Apr 17, 2026
Merged

Fix UxDataset constructor and to_xarray() that got broken with xarray==2026.4.0#1492
erogluorhan merged 5 commits intomainfrom
fix_copy_constructor

Conversation

@erogluorhan
Copy link
Copy Markdown
Member

@erogluorhan erogluorhan commented Apr 16, 2026

Closes #1490

Overview

Avoid xr.Dataset(xr.Dataset) calls in our constructor and to_xarray() as it got prohibited as of xarray's 2026.4.0.

Expected Usage

No change to the user API.

PR Checklist

General

  • An issue is linked created and linked
  • Add appropriate labels
  • Filled out Overview and Expected Usage (if applicable) sections

Comment thread uxarray/core/dataset.py
@rajeeja
Copy link
Copy Markdown
Contributor

rajeeja commented Apr 17, 2026

Please add a small test also or something similar:

def test_uxdataset_init_from_xarray_dataset():
    ds = xr.Dataset(
        data_vars={"a": ("x", [1, 2])},
        coords={"x": [10, 20]},
        attrs={"source": "testing"},
    )

    uxds = ux.UxDataset(ds)

    assert "a" in uxds.data_vars
    assert "x" in uxds.coords
    assert uxds.attrs["source"] == "testing"

@erogluorhan erogluorhan requested a review from rajeeja April 17, 2026 17:53
@erogluorhan erogluorhan merged commit 1c57074 into main Apr 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ux.open_dataset and other functions failing with xarray==2026.4.0

2 participants